/*     */ package com.alipay.util;
/*     */ 
/*     */ import java.io.FileWriter;
/*     */ import java.io.UnsupportedEncodingException;
/*     */ import java.net.URLEncoder;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Collections;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class AlipayBase
/*     */ {
/*     */   public static String BuildMysign(Map sArray, String key)
/*     */   {
/*  46 */     String prestr = CreateLinkString(sArray);
/*  47 */     prestr = prestr + key;
/*  48 */     String mysign = Md5Encrypt.md5(prestr);
/*  49 */     return mysign;
/*     */   }
/*     */ 
/*     */   public static Map ParaFilter(Map sArray)
/*     */   {
/*  58 */     List keys = new ArrayList(sArray.keySet());
/*  59 */     Map sArrayNew = new Hashtable();
/*     */ 
/*  61 */     for (int i = 0; i < keys.size(); i++) {
/*  62 */       String key = (String)keys.get(i);
/*  63 */       String value = (String)sArray.get(key);
/*     */ 
/*  65 */       if ((value.equals("")) || (value == null) || (key.equalsIgnoreCase("sign")) || (key.equalsIgnoreCase("sign_type")))
/*     */       {
/*     */         continue;
/*     */       }
/*     */ 
/*  70 */       sArrayNew.put(key, value);
/*     */     }
/*     */ 
/*  73 */     return sArrayNew;
/*     */   }
/*     */ 
/*     */   public static String CreateLinkString(Map params)
/*     */   {
/*  82 */     List keys = new ArrayList(params.keySet());
/*  83 */     Collections.sort(keys);
/*     */ 
/*  85 */     String prestr = "";
/*     */ 
/*  87 */     for (int i = 0; i < keys.size(); i++) {
/*  88 */       String key = (String)keys.get(i);
/*  89 */       String value = (String)params.get(key);
/*     */ 
/*  91 */       if (i == keys.size() - 1)
/*  92 */         prestr = prestr + key + "=" + value;
/*     */       else {
/*  94 */         prestr = prestr + key + "=" + value + "&";
/*     */       }
/*     */     }
/*     */ 
/*  98 */     return prestr;
/*     */   }
/*     */ 
/*     */   public static String CreateLinkString_urlencode(Map params, String input_charset)
/*     */   {
/* 109 */     List keys = new ArrayList(params.keySet());
/* 110 */     Collections.sort(keys);
/*     */ 
/* 112 */     String prestr = "";
/*     */ 
/* 114 */     for (int i = 0; i < keys.size(); i++) {
/* 115 */       String key = (String)keys.get(i);
/* 116 */       String value = (String)params.get(key);
/*     */       try
/*     */       {
/* 119 */         prestr = prestr + key + "=" + URLEncoder.encode(value, input_charset) + "&";
/*     */       }
/*     */       catch (UnsupportedEncodingException e) {
/* 122 */         e.printStackTrace();
/*     */       }
/*     */     }
/*     */ 
/* 126 */     return prestr;
/*     */   }
/*     */ 
/*     */   public static void LogResult(String sWord)
/*     */   {
/*     */     try
/*     */     {
/* 136 */       FileWriter writer = new FileWriter("D:\\alipay_log" + System.currentTimeMillis() + ".txt");
/* 137 */       writer.write(sWord);
/* 138 */       writer.close();
/*     */     } catch (Exception e) {
/* 140 */       e.printStackTrace();
/*     */     }
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.alipay.util.AlipayBase
 * JD-Core Version:    0.6.0
 */